﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TZLB.aspx.cs" Inherits="Xiaov.SmartWeb.Application.TZXMGC.TZLB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>类别管理表</title>
    <script src="../binary/dynaload.js?66" type="text/javascript"></script>
    <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script language="JavaScript">
        function OnReady(id) {
            form1.AF.func("Build", "data/tzlbHead.xml");
            form1.AF.func("Load", "data/TZLBData.aspx");
            form1.AF.func("expand", "Level1");
            enableDrag();
        }

        function enableDrag() {
            //AF2 Self dragAble
            handle = form1.AF.func("GetHandle", "");
            form1.AF.func("EnableDrag", handle);
        }
        function save() {
            var xml = form1.AF.func("GetChangedXML", "level=1");
//                        alert(xml);
//                        return;
            if (xml == null || xml == "") {
                form1.AF.func("MessageBoxFloat", "请先作增、删、改操作!	");
            }
            else if (xml != "0") {
                $.ajax({
                    type: "post",
                    url: "/TZXMGC/TZLBSave.aspx",
                    dataType: "json",
                    data: { xml: xml },
                    success: function (data) {
                        var jsonData = data;
                        if (jsonData.save == 0)
                        { alert("保持失败"); }
                        else
                        { alert("保持成功"); }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(errorThrown);
                    }
                });
            }
        }
        function OnEvent(id, Event, p1, p2, p3, p4) {
            if (Event == "rowsInserted") {
                var id = $("#hfID").val();
                $("#hfID").attr("value", parseInt(id) + 1);
                //                id = $("#hfID").val();
                //                alert(id);
                form1.AF.func("SetCellData", p1 + "\r\nTZLBBM\r\n" + id)
                //                var endcol = form1.AF.func("GetNextValidCol", p4);
                //                var endrow = parseInt(p3) + 1;
                //                for (var row = p1; row < endrow; row++) {
                //                    for (var col = p2; col != endcol; col = form1.AF.func("GetNextValidCol", col)) {
                //                        var data = form1.AF.func("GetCellData", row + "\r\n" + col);
                //                        //                        alert(parseInt(data));
                //                        if (data == 0) {
                //                            //                            alert(data);
                //                        }
                //                    }
                //                }
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input id="Button1" type="button" value="保存" onclick="save()" />
        <asp:HiddenField ID="hfID" runat="server" Value="1" />
    </div>
    <div style="position: relative; width: 700px; height: 600px">
        <script>            insertTreeList('AF', '')</script>
    </div>
    </form>
</body>
</html>
